package com.saltfish.library.controller;

import com.saltfish.library.mapper.DoPlanMapper;
import com.saltfish.library.pojo.DoPlan;
import com.saltfish.library.sevice.DoPlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/doplan")
public class DoPlanController {

    @Autowired
    DoPlanService doPlanService;

    @RequestMapping("insert")
    public boolean insert(DoPlan doPlan){
       // System.out.println(doPlan.getDpid());
        return doPlanService.dpInert(doPlan);
    }

    @RequestMapping("delete")
    public boolean delete(String dpid){
        return doPlanService.dpDelete(dpid);
    }

    @RequestMapping("deleteall")
    public boolean deleteAll(String[] dpids){
        return doPlanService.dpDelete(dpids);
    }

    @RequestMapping("select")
    public List<DoPlan> dpSelect(String sid){
        return doPlanService.dpSelect(sid);
    }

    @RequestMapping("list")
    public List<DoPlan> list(){
        return doPlanService.list();
    }

}
